#pragma once
#ifndef __OLED_HARDWARE_I2C_H
#define __OLED_HARDWARE_I2C_H

#include <basic.h>
#ifdef __cplusplus
extern "C"
{
#endif

#define OLED_WIDTH 128
#define OLED_HEIGHT 64
#define OLED_ADDR (0x3c << 1)
#define I2C_TIMEOUT_MS (10)

#define OLED_CMD 0  // 写命令
#define OLED_DATA 1 // 写数据

    // OLED控制用函数
    void OLED_ColorTurn(uint8_t i);
    void OLED_DisplayTurn(uint8_t i);
    void OLED_Set_Pos(uint8_t x, uint8_t y);
    void OLED_Display_On(void);
    void OLED_Display_Off(void);
    void OLED_Clear(void);
    void OLED_ShowChar(uint8_t x, uint8_t y, uint8_t chr, uint8_t sizey);
    uint32_t oled_pow(uint8_t m, uint8_t n);
    void OLED_ShowNum(uint8_t x, uint8_t y, uint32_t num, uint8_t len, uint8_t sizey);
    void OLED_ShowString(uint8_t x, uint8_t y,const char *chr, uint8_t sizey);
    void OLED_ShowChinese(uint8_t x, uint8_t y, uint8_t no, uint8_t sizey);
    void OLED_DrawBMP(uint8_t x, uint8_t y, uint8_t sizex, uint8_t sizey,const uint8_t* BMP);

    void OLED_Init(void);
    void OLED_WR_Byte(uint8_t dat, uint8_t mode);

#ifdef __cplusplus
}
#endif

#endif /* #ifndef __OLED_HARDWARE_I2C_H */
